package com.lh.exceptions;

import com.lh.entity.Result;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class GloabExceptionHandler {
    @ExceptionHandler
    public Result GloabExceptionHandler(Exception e) {
        e.getMessage();
                if (StringUtils.hasLength(e.getMessage()) ) {
                    return Result.error(e.getMessage());
                } else{
                    return Result.error("操作失败");
                }
    }
}
